// http://javascript.ruanyifeng.com/nodejs/express.html#toc2
const express = require('express');
const common = require('../app/controllers/common');
const path = require('path');
const BS = path.resolve();

module.exports = function(app) {
	app.set('views', path.join(BS, '/app/views'));
	app.set('view engine', 'jade');
	app.use('/static', express.static(path.join(BS, 'public')));

	app.get('/', common.index);
	app.get('/about', common.about);

	app.get('*', (req, res) => {
		res.writeHead(404, {'Content-Type': 'text/plain'});
		res.end('404 error!\n');
	});
}
